/******************************************************************************
* SVN­Version­Information:
* ­­­­­­­­­­­­­­­­­­­­­­­­---------------------
* $LastChangedRevision: 116 $
* $LastChangedBy: MR $
* $LastChangedDate: 2009-06-21 16:08:09 +0200 (Sun, 21 Jun 2009) $
* $HeadURL: svn://lvis10.fbm.fht-stuttgart.de/common/Common/src/de/hft_stuttgart/botwar/common/commands/KickCmd.java $
*******************************************************************************/

package de.hft_stuttgart.botwar.common.commands;

/**
 * This command represents a KickCmd to inform client
 * @author sdegiorgi@gmail.com
 */
public final class KickCmd extends Cmd {

    private final String kickedBy;
    private final String kicked;
    private final String kickReason;

 /**
  * @param kickedBy Who issued the kick
  * @param kicked Who was kicked
  */
    public KickCmd(final String kickedBy, final String kicked) {
        this.kickedBy   = kickedBy;
        this.kicked     = kicked;
        this.kickReason = "";
    }

/**
  * @param kickedBy Who issued the kick
  * @param kicked Who was kicked
 *  @param reason A textual representation why the kick was issued
  */
    public KickCmd(final String kickedBy, final String kicked,
            final String reason) {
        this.kickedBy   = kickedBy;
        this.kicked     = kicked;
        this.kickReason = reason;
    }

    /**
     * Getter to retrieve the reason for kick
     * @return String stating the reason
     */
    public String getKickReason() {
        return kickReason;
    }

    /**
     * Getter to retrieve who issued the kick
     * @return String stating KickedBy
     */
    public String getKickedBy() {
        return kickedBy;
    }

    /**
     * Getter to retrieve who was kicked
     * @return String stating who was kicked
     */
    public String getKicked() {
        return kicked;
    }

    /**
     * Overrides the equals method.
     * @param obj object to compare
     * @return boolean true or false
     */
    @Override
    public boolean equals(final Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final KickCmd other = (KickCmd) obj;
        if(this.kickedBy.equals(other.getKickedBy()) &&
                this.kicked.equals(other.getKicked())) {
            return true;
        }
        return false;
    }

    /**
     * Method to get a String representation of the object
     * @return String stating the Object
     */
    @Override
    public String toString(){
        return String.format("%s kicked by %s.", getKicked(), getKickedBy());

    }
}

